home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00002_Script_key manager class
next >
Wrap
Text File
|
1997-08-08
|
2KB
|
106 lines
-- key manager class
-- --------------------------------------------------
-- fairly stupid just keeps track of which keys are down
-- because mac cannot handle the keyboard properly
-- we just track the last key: downkey
-- sets to 0 if no key down
-- --------------------------------------------------
property codeindex
property downkey
global gplayer, gkeylist
-- ==================================================
-- new method
-- --------------------------------------------------
on new me
minit me
return me
end mnew
-- ==================================================
-- new method
-- --------------------------------------------------
on minit me
set codeindex = gkeylist
set downkey = 0
end minit me
-- ==================================================
-- mdown method
-- --------------------------------------------------
on mdown me
-- put "** in mdown key manager "
set newkey = getone ( codeindex, the keycode )
if newkey = downkey then
-- put "ò keyboard autorepeat!"
return
end if
if symbolp (newkey) then
if newkey = #quit then
hendgame
go frame "quit"
return
else
set downkey = newkey
mkeydown ( gplayer , downkey )
end if
end if
-- put "** out mdown key manager "
end mdown
-- ==================================================
-- mup method
-- --------------------------------------------------
on mup me
-- put "in mup key manager "
set newkey = getone ( codeindex, the keycode )
if ( newkey = downkey ) then
set downkey = 0
else
-- put "ò complex keys!"
end if
-- put "out mup key manager "
end mup
-- ==================================================
-- mgetlastest method
-- --------------------------------------------------
on mgetlatest me
-- put "in mgetlatest key"
return downkey
-- put "out mgetlatest key"
end mgetlatest